import { ref } from 'vue'
import sdk from '@/utils/sdk'

export const inBox = ref(true)
export const getUid = async () => {
  try {
    const uid = sessionStorage.getItem('uid')
    if (uid) {
      return uid
    } else {
      const gw = sdk
      const session = await gw.session
      const { uid } = session
      sessionStorage.setItem('uid', uid)
      return uid
    }
  } catch (error) {
    inBox.value = false
  }
}
